﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Text;
public partial class GetUccInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["uccidx"] == null)
        {
            Response.End();
            return;
        }

        //카테고리 초기화
        //1. DB INSERT Setting
        SqlConnection sqlConn = new SqlConnection();
        sqlConn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString;

        SqlDataAdapter sqldap = new SqlDataAdapter();
        sqldap.SelectCommand = new SqlCommand();
        sqldap.SelectCommand.Connection = sqlConn;

        DataSet ds = new DataSet();

        sqldap.SelectCommand.CommandText = "select * from [ucclight] where uccidx=" + Request.QueryString["uccidx"];

        sqldap.Fill(ds);

        //System.Xml.XmlTextWriter writer =
        //    new System.Xml.XmlTextWriter(this.Response.OutputStream, System.Text.Encoding.UTF8);
        //writer.Formatting = System.Xml.Formatting.Indented;
        //writer.WriteStartDocument();
        //writer.Indentation = 4;
        //writer.WriteStartElement("request");
        //writer.WriteStartElement("target");
        //writer.WriteAttributeString("form", strform);
        //writer.WriteAttributeString("obj", strtarget);
        //writer.WriteEndElement();
        //writer.WriteStartElement("items");

        //foreach (DataRow dr in ds.Tables[0].Rows) // 아이템을보여주는부분.
        //{
        //    writer.WriteStartElement("item");
        //    writer.WriteAttributeString("text", dr["codename"].ToString());
        //    writer.WriteAttributeString("value", dr["code"].ToString());
        //    writer.WriteEndElement();
        //}


        //writer.WriteEndDocument();
        //Response.ContentEncoding = System.Text.Encoding.UTF8;
        //Response.ContentType = "text/xml";
        //writer.Flush();
        //writer.Close();


        //제목
        Response.Write(ds.Tables[0].Rows[0]["UCCTitle"].ToString() + "§");

        //대표이미지
        Response.Write(ds.Tables[0].Rows[0]["UCCImage"].ToString() + "§");

        //썸네일 이미지
        Response.Write(ds.Tables[0].Rows[0]["UCCThumbnail"].ToString() + "§");

        //파일경로
        Response.Write(ds.Tables[0].Rows[0]["UCCFile"].ToString());

        Response.End();
    }
}
